﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DTM.Repository
{
    /// <summary>
    /// Interface <see cref="IRepository"/> define generic repository.
    /// </summary>
    public interface IRepository<T> : IDisposable
    {
        #region Methods

        /// <summary>
        /// Delete entity by id.
        /// </summary>
        /// <param name="entityId">EntityId to delete.</param>
        void Delete(int entityId);

        /// <summary>
        /// Returns all entities.
        /// </summary>
        /// <returns></returns>
        IEnumerable<T> GetAll();

        /// <summary>
        /// Inserts new entity.
        /// </summary>
        /// <param name="entity">Entity to insert.</param>
        /// <returns></returns>
        T Insert(T entity);

        /// <summary>
        /// Update entity values.
        /// </summary>
        /// <param name="entity">Entity to update.</param>
        void Update(T entity);

        #endregion Methods
    }
}